package com.gxnzd.communityelderly.controller;

import com.gxnzd.communityelderly.commom.R;
import com.gxnzd.communityelderly.dao.ReqDiagnosis;
import com.gxnzd.communityelderly.entity.Diagnosis;
import com.gxnzd.communityelderly.service.DiagnosisService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName: DiagnosisController
 * Package: com.gxnzd.communityelderly.controller
 * Description:
 *
 * @Author 胡海峰
 * @Create 2024/11/11 19:36
 * @Version 1.0
 */
@RestController
@CrossOrigin
@RequestMapping("/diagnosis")
public class DiagnosisController {

    @Resource
    private DiagnosisService diagnosisService;

    //通过用户id 获取用户的就诊记录
    @GetMapping("/List")
    public R getUserDiagnosis(Long userId){
        return diagnosisService.getUserDiagnosisList(userId);
    }

    //添加就诊记录 并且修改预约记录状态
    @PostMapping("/add")
    public R addDiagnosisInfo(@RequestBody ReqDiagnosis reqDiagnosis){
        return diagnosisService.addInfo(reqDiagnosis);
    }

    //根据预约id获取就诊信息
    @GetMapping("/details/{reservationId}")
    public R getDiagnosisDetails(@PathVariable Long reservationId){
        return diagnosisService.getDetails(reservationId);
    }

    //确认支付
    @GetMapping("/confirmPay/{id}")
    public R confirmPayment(@PathVariable Long id){
        return diagnosisService.confirmPayment(id);
    }
}
